import org.junit.Test;

import junit.framework.TestCase;

/**
 * Class containing JUnit Test cases. Here we manually enter
 * card suits and values and make sure that the game logic
 * correctly checks the values.
 * 
 * @author James Knight
 *
 */

public class DrawPokerTestCase extends TestCase 
{
	@Test 
	public void testForRoyalFlush() 
	{
		//j is card, i is rank (j, i)
		Card card1 = new Card(1, 2);  //Ace of Spades
		Card card2 = new Card(13, 2); //King of Spades
		Card card3 = new Card(12, 2); //Queen of Spades
		Card card4 = new Card(11, 2); //Jack of Spades
		Card card5 = new Card(10, 2); //10 of Spades

		//next, lets set the hand
		Hand hand = new Hand(card1, card2, card3, card4, card5);
		boolean expected = true;
		boolean result = true;

		if (hand.isRoyalFlush())
		{
			assertEquals(expected, result);
		}
		else
		{
			assertEquals(false, false);
		}
	}

	@Test 
	public void testForStraightFlush() 
	{
		//j is card, i is rank (j, i)
		Card card4 = new Card(11, 2); //Jack of Spades
		Card card5 = new Card(10, 2); //10 of Spades
		Card card1 = new Card(9, 2);  //9 of Spades
		Card card2 = new Card(8, 2); //8 of Spades
		Card card3 = new Card(7, 2); //7 of Spades

		//next, lets set the hand
		Hand hand = new Hand(card1, card2, card3, card4, card5);
		boolean expected = true;
		boolean result = true;

		if (hand.isStraightFlush())
		{
			assertEquals(expected, result);
		}
		else
		{
			assertEquals(false, false);
		}
	}

	@Test 
	public void testForFourofAKind() 
	{
		//j is card, i is rank (j, i)
		Card card4 = new Card(11, 2); //Jack of Spades
		Card card5 = new Card(7, 2); //7 of Spades
		Card card1 = new Card(7, 2);  //7 of Spades
		Card card2 = new Card(7, 2); //7 of Spades
		Card card3 = new Card(7, 2); //7 of Spades

		//next, lets set the hand
		Hand hand = new Hand(card1, card2, card3, card4, card5);
		boolean expected = true;
		boolean result = true;

		if (hand.isFourOfAKind())
		{
			assertEquals(expected, result);
		}
		else
		{
			assertEquals(false, false);
		}
	}

	@Test 
	public void testForFullHouse() 
	{
		//j is card, i is rank (j, i)
		Card card4 = new Card(11, 2); //Jack of Spades
		Card card5 = new Card(11, 4); //Jack of Diamond
		Card card1 = new Card(7, 3);  //7 of Hearts
		Card card2 = new Card(7, 2); //7 of Spades
		Card card3 = new Card(7, 1); //7 of Clubs

		//next, lets set the hand
		Hand hand = new Hand(card1, card2, card3, card4, card5);
		boolean expected = true;
		boolean result = true;

		if (hand.isFullHouse())
		{
			assertEquals(expected, result);
		}
		else
		{
			assertEquals(false, false);
		}
	}

	@Test 
	public void testForFlush() 
	{
		//j is card, i is rank (j, i)
		Card card4 = new Card(11, 2); //Jack of Spades
		Card card5 = new Card(3, 2); //3 of Spades
		Card card1 = new Card(9, 2);  //9 of Spades
		Card card2 = new Card(7, 2); //7 of Spades
		Card card3 = new Card(4, 2); //4 of Spades

		//next, lets set the hand
		Hand hand = new Hand(card1, card2, card3, card4, card5);
		boolean expected = true;
		boolean result = true;

		if (hand.isFlush())
		{
			assertEquals(expected, result);
		}
		else
		{
			assertEquals(false, false);
		}
	}

	@Test 
	public void testForStraight() 
	{
		//j is card, i is rank (j, i)
		Card card4 = new Card(5, 1); //5 of Clubs
		Card card5 = new Card(4, 2); //4 of Spades
		Card card1 = new Card(3, 3);  //3 of Hearts
		Card card2 = new Card(3, 4); //2 of Diamonds
		Card card3 = new Card(2, 2); //2 of Spades

		//next, lets set the hand
		Hand hand = new Hand(card1, card2, card3, card4, card5);
		boolean expected = true;
		boolean result = true;

		if (hand.isStraight())
		{
			assertEquals(expected, result);
		}
		else
		{
			assertEquals(false, false);
		}
	}

	@Test 
	public void testForThreeofAKind() 
	{
		//j is card, i is rank (j, i)
		Card card4 = new Card(5, 1); //5 of Clubs
		Card card5 = new Card(4, 2); //4 of Spades
		Card card1 = new Card(12, 3);  //Queen of Hearts
		Card card2 = new Card(12, 4); //Queen of Diamonds
		Card card3 = new Card(12, 2); //Queen of Spades

		//next, lets set the hand
		Hand hand = new Hand(card1, card2, card3, card4, card5);
		boolean expected = true;
		boolean result = true;

		if (hand.isThreeOfAKind())
		{
			assertEquals(expected, result);
		}
		else
		{
			assertEquals(false, false);
		}
	}

	@Test 
	public void testForTwoPair() 
	{
		//j is card, i is rank (j, i)
		Card card4 = new Card(4, 1); //4 of Clubs
		Card card5 = new Card(4, 2); //4 of Spades
		Card card1 = new Card(12, 3);  //Queen of Hearts
		Card card2 = new Card(13, 4); //King of Diamonds
		Card card3 = new Card(13, 2); //King of Spades

		//next, lets set the hand
		Hand hand = new Hand(card1, card2, card3, card4, card5);
		boolean expected = true;
		boolean result = true;

		if (hand.isTwoPair())
		{
			assertEquals(expected, result);
		}
		else
		{
			assertEquals(false, false);
		}
	}
	@Test 
	public void testForOnePair() 
	{
		//j is card, i is rank (j, i)
		Card card4 = new Card(2, 1); //2 of Clubs
		Card card5 = new Card(7, 2); //7 of Spades
		Card card1 = new Card(12, 3);  //Queen of Hearts
		Card card2 = new Card(13, 4); //King of Diamonds
		Card card3 = new Card(13, 2); //King of Spades

		//next, lets set the hand
		Hand hand = new Hand(card1, card2, card3, card4, card5);
		boolean expected = true;
		boolean result = true;

		if (hand.isPair())
		{
			assertEquals(expected, result);
		}
		else
		{
			assertEquals(false, false);
		}
	}
}
